use([
    "public/javascripts/service/trdOrdersListService.js",
    "public/javascripts/widget/slider/slider.js",
    "public/common/classNames.js",
    "public/javascripts/trdOrdersList/orderFactory.js",
    "public/javascripts/widget/dialog/dialog.js",
    "public/javascripts/widget/prompt/prompt.js"
    ], function(trdOrdersListService, SliderComponent, classNames, orderFactory, DialogComponent, PromptComponent) {
    var cx = classNames;
    var PageComponent = React.createClass({
        componentWillMount: function() {
            var self = this;
            for(var i in orderFactory) this[i] = orderFactory[i].bind(this);
            this.selectOrderTypeFn = this.selectItemFn('selectOrderType');
            this.selectOrderListFn = this.selectItemFn('selectOrderList');
            trdOrdersListService.goodstypeList(function(res){
                if(res.errorCode == 0){
                    self.setState({
                        orderTypes : res.data
                    });
                }
            });
            trdOrdersListService.platcompanys(function(res) {
                if(res.errorCode == 0) {
                    self.setState({purchase : res.data,purchaseId : res.data[0].id});
                    orderFactory.searchBySelect.apply(self);
                }
            });
        },
        componentDidMount: function() {
            orderFactory.addScroll();

        },
        receiveMsg: function(data) {

        },
        getInitialState: function () {
            var state = {
                selectOrderType : {},
                selectOrderList : {}
            };
            return state;
        },
        render:function() {
            var data = this.state.data, list = this.state.list || [],
                selectOrderType = this.state.selectOrderType,
                selectOrderList = this.state.selectOrderList,
                orderTypes = this.state.orderTypes || [],
                purchase = this.state.purchase || [],
                Browser = typeof window != 'undefined',
                purchaseId = this.state.purchaseId,
                total = this.state.total || 0,
                component = this;
            return ~init;
        }
    });
    if(typeof ReactDOM != "undefined") {
        ReactDOM.render(<PageComponent data={storage}/>, document.getElementById('container'));
    }
    module.exports = PageComponent;
});